package edu.gatech.cc.liam.core;

import java.util.Map.Entry;

public class Pair<T1, T2> implements Entry<T1, T2> {
	
	public T1 obj1;
	public T2 obj2;
	public Pair(T1 obj1, T2 obj2) {
		super();
		this.obj1 = obj1;
		this.obj2 = obj2;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((obj1 == null) ? 0 : obj1.hashCode());
		result = prime * result + ((obj2 == null) ? 0 : obj2.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Pair<T1, T2> other = (Pair<T1, T2>) obj;
		if (obj1 == null) {
			if (other.obj1 != null)
				return false;
		} else if (!obj1.equals(other.obj1))
			return false;
		if (obj2 == null) {
			if (other.obj2 != null)
				return false;
		} else if (!obj2.equals(other.obj2))
			return false;
		return true;
	}
	@Override
	public String toString() {
		return "Pair (" + obj1 + ", " + obj2 + ")";
	}

	@Override
	public T1 getKey() {
		return obj1;
	}
	@Override
	public T2 getValue() {
		return obj2;
	}
	@Override
	public T2 setValue(Object value) {
		throw new UnsupportedOperationException();
	}

	
}
